package su.security.service.impl;

import java.util.List;

import net.kuakao.core.dto.PagerDTO;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;

import su.base.Constants;
import su.security.dao.ISecurityUrlDAO;
import su.security.entity.SecurityUrl;
import su.security.service.SecurityUrlService;

public class SecurityUrlServiceImpl implements SecurityUrlService {
	@Autowired
	private ISecurityUrlDAO urlDAO;
	
	private final Log log = LogFactory.getLog(getClass());
	//==============
	public List<SecurityUrl> queryByPage(PagerDTO s){
		List<SecurityUrl> list = null;
		try {
			list = urlDAO.queryByPage(s);
		} catch (Exception e) {
			log.error(e.getMessage());
		}
		return list;
	}
	public SecurityUrl getBaseinfo(int id){
		SecurityUrl baseinfo = null;
		try {
			baseinfo = urlDAO.getBaseinfo(id);
		} catch (Exception e) {
			log.error(e.getMessage());
		}
		return baseinfo;
	}
	public List<SecurityUrl> getAllUrl(){
		List<SecurityUrl> list = null;
		try {
			list = urlDAO.getAllUrl();
		} catch (Exception e) {
			log.error(e.getMessage());
		}
		return list;
	}
	public List<SecurityUrl> getUrlList(String ids){
		List<SecurityUrl> list = null;
		try {
			list = urlDAO.getUrlList(ids);
		} catch (Exception e) {
			log.error(e.getMessage());
		}
		return list;
	}
	//---------------
	public void save(SecurityUrl o)throws Exception {
		o.setStatus(Constants.STATUS_ENABLE);
		o.setUrl(o.getUrl().trim());
		if(o.getId()==0){
			urlDAO.insert(o);
		}else{
			urlDAO.update(o);
		}
	}
	public void remove(int id)throws Exception{
		urlDAO.remove(id);
	}
}
